//
//  OrderCell.m
//  MyNewBase
//
//  Created by 胡超 on 16/3/10.
//  Copyright © 2016年 lbanma. All rights reserved.
//

#import "OrderCell.h"

@implementation OrderCell

-(UILabel *)nameLabel{
    if (!_nameLabel) {
        _nameLabel = [UILabel new];
        _nameLabel.textColor = [UIColor blueColor];
        _nameLabel.numberOfLines = 1;
        _nameLabel.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:_nameLabel];
        [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.left.mas_equalTo(10);
            make.bottom.mas_equalTo(self.lineView.mas_top).mas_equalTo(-10);
        }];
    }
    return _nameLabel;
}
-(UILabel *)stateLabel{
    if (!_stateLabel) {
        _stateLabel = [UILabel new];
        _stateLabel.numberOfLines = 1;
        _stateLabel.font = [UIFont systemFontOfSize:10];
        _stateLabel.textColor = [UIColor yellowColor];
        [self.contentView addSubview:_stateLabel];
        [_stateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self.nameLabel.mas_centerY);
            make.right.mas_equalTo(-10);
        }];
    }
    return _stateLabel;
}

-(UIView *)lineView{
    if (!_lineView) {
        _lineView = [[UIView alloc]init];
        _lineView.backgroundColor = [UIColor grayColor];
        [self.contentView addSubview:_lineView];
        [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.nameLabel.mas_bottom).mas_equalTo(10);
            make.leftMargin.mas_equalTo(self.nameLabel.mas_leftMargin);
            make.right.mas_equalTo(0);
            make.height.mas_equalTo(0.5);
        }];
        
    }
    return _lineView;
}

-(UIImageView *)headView{
    if (!_headView) {
        _headView = [UIImageView new];
        _headView.contentMode = 2;
        _headView.clipsToBounds = YES;
        [self.contentView addSubview:_headView];
        [_headView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.lineView.mas_bottom).mas_equalTo(10);
            make.leftMargin.mas_equalTo(self.nameLabel.mas_leftMargin);
            make.size.mas_equalTo(CGSizeMake(80, 60));
            make.bottom.mas_equalTo(-10);
        }];
    }
    return _headView;
}

-(UILabel *)moneyLabel{
    if (!_moneyLabel) {
        _moneyLabel = [UILabel new];
        _moneyLabel.numberOfLines = 1;
        _moneyLabel.font = [UIFont systemFontOfSize:12];
        _moneyLabel.textColor = [UIColor redColor];
        [self.contentView addSubview:_moneyLabel];
        [_moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.topMargin.mas_equalTo(self.headView.mas_topMargin);
            make.left.mas_equalTo(self.headView.mas_right).mas_equalTo(10);
            
        }];
    }
    return _moneyLabel;
}

-(UILabel *)timeLabel{
    if (!_timeLabel) {
        _timeLabel = [UILabel new];
        _timeLabel.numberOfLines = 1;
        _timeLabel.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:_timeLabel];
        [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self.headView.mas_centerY);
            make.leftMargin.mas_equalTo(self.moneyLabel.mas_leftMargin);
            
        }];
    }
    return _timeLabel;
}

-(UILabel *)giveLabel{
    if (!_giveLabel) {
        _giveLabel = [UILabel new];
        _giveLabel.numberOfLines = 1;
        _giveLabel.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:_giveLabel];
        [_giveLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leftMargin.mas_equalTo(self.moneyLabel.mas_leftMargin);
            make.bottomMargin.mas_equalTo(self.headView.mas_bottomMargin);
        }];
    }
    return _giveLabel;
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.contentView.backgroundColor = kRGBColor(250, 122, 60);
    }
    return self;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
